package com.shuai.service;

import com.shuai.api.UserService;
import com.shuai.model.Order;
import com.shuai.model.User;

import java.util.ArrayList;


/**
 * @author shuaihong-coding
 * @date 2025/10/2
 * @className UserServiceImpl
 */
public class UserServiceImpl implements UserService {
    @Override
    public User getUserInfo(String  username) {
        // 查询数据库，获取订单信息
        // 省略了mapper层的操作
        ArrayList<Order> orders = new ArrayList<>();
        Order order_01 = Order.builder()
                .orderName("订单001")
                .price(5.0)
                .count(1)
                .build();
        Order order_02 = Order.builder()
                .orderName("订单002")
                .price(10.0)
                .count(2)
                .build();
        Order order_03 = Order.builder()
                .orderName("订单003")
                .price(15.0)
                .count(3)
                .build();

        orders.add(order_01);
        orders.add(order_02);
        orders.add(order_03);

        User user = User.builder()
        .username(username)
        .age(21)
        .gender("男")
        .money(100.0)
        .orderList(orders)
        .build();

        return user;
    }
}
